<?php
/**
 *
 * @author Administrator
 *        
 */
class Sms_log_model extends MY_CI_Model
{
    
    /**
     *
     * @access public
     *        
     */
    public function __construct()
    {
    	$this->table 		= 'sms_log';
    	$this->primary_id 	= 'rec_id';
    	$this->primary_name	= 'mobile';
    	
    	parent::__construct();
        $this->admin_name = $this->session->userdata('admin_name');
        
    }

    /**
     * 删除数据
     * @param unknown $primary_id
     * @return multitype:number string
     */
    public function delete_data($primary_id)
    {
    	try {
    		$log_ids = $primary_id;
    		if(is_array($primary_id)){
    			$log_ids = join(',', $primary_id);
    			$this->db->where_in($this->primary_id, $primary_id);
    		}else{
    			$this->db->where($this->primary_id, $primary_id);
    		}
    		$log_msg = '删除短信日志成功!';
    		$this->db->delete($this->table);
    		$this->result[$this->primary_id] = $primary_id;
    	} catch (Exception $e) {
    		$log_msg = '删除短信日志失败!';
    		$this->result['error'] = 1;
    		$this->result['message'] = $e->getMessage();
    	}
    	$log_info = sprintf("[%s]$log_msg", $this->admin_name);
    	add_admin_log($log_action = 'delete sms_log', $log_ids, $log_info);
    	return $this->result;
    }

}

?>